package org.dicker.dao.impl;

import java.util.List;

import org.dicker.dao.ManagerDao;
import org.dicker.entity.ManagerInfo;
import org.dicker.util.ORMUtil;


public class ManagerDaoImpl implements ManagerDao {

	@Override
	public List<ManagerInfo> selectManagerList(String account, String password) {

		String sql="SELECT * FROM tb_manager_uesr WHERE (user_name=? or user_email=?) AND user_password=? ";
		
		List<ManagerInfo> list = ORMUtil.getInstance().selectList(ManagerInfo.class, sql,account,account,password); 
		
		return list;
	}

	@Override
	public ManagerInfo selectManagerID(int user_id) {
		String sql="SELECT * FROM tb_manager_uesr WHERE user_id=? ";
		List<ManagerInfo> list =ORMUtil.getInstance().selectList(ManagerInfo.class, sql, user_id);
		return list.size() > 0 ? list.get(0) : null;
	}

}
